import {request} from 'umi';

export async function fetchList(body) {
  return request('/tenant/user/list', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function add(body) {
  return request('/tenant/user/add', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function edit(body) {
  return request('/tenant/user/edit', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function del(body) {
  return request('/tenant/user/del', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function resetPass(body) {
  return request('/tenant/user/reset-pass', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function fetchInfo() {
  return request('/tenant/user/info', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
  });
}

export async function modifyPass(body) {
  return request('/tenant/user/modify-pass', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}


export async function modifyUserInfo(body) {
  return request('/tenant/user/modify-user-info', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
  });
}

export async function avatar(avatar) {
  return request(`/tenant/user/avatar?avatar=${avatar}`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
  });
}
